package prv.pursuivant.armory;

import java.io.IOException;

import prv.pursuivant.core.Toon;
import prv.pursuivant.core.ToonAchievements;

/**
 * Mechanics for caching data (i.e. on the disk)
 * 
 * @author Kwinto
 */
public interface Cache {

	/**
	 * Reads list of toon's achievement from the cache
	 * 
	 * @param toon
	 * @return list of achievements from cache or null when there is no cache or
	 *         cache is too old
	 * @throws IOException
	 */
	ToonAchievements read(Toon toon) throws IOException;

	/**
	 * Reads list of toon's achievement from the cache. Doesn't care about cache
	 * time
	 * 
	 * @param toon
	 * @return list of achievements from cache or null when there is no cache
	 * @throws IOException
	 */
	ToonAchievements readEvenOld(Toon toon) throws IOException;

	/**
	 * Writes list of toon's achievement to the cache
	 * 
	 * @param toon
	 * @param achievs
	 * @throws IOException
	 */
	void write(Toon toon, ToonAchievements achievs) throws IOException;

}
